import {Component, OnInit, Input, SimpleChanges} from '@angular/core';
import {TagData} from '../../../../entity/tag-data.model';

@Component({
  selector: 'app-turbine-system-details',
  templateUrl: './turbine-system-details.component.html',
  styleUrls: ['./turbine-system-details.component.css']
})
export class TurbineSystemDetailsComponent implements OnInit {
  @Input() title: string;
  @Input() image: Images;
  @Input() data: TagData[];
  @Input() switchingValue1: string;
  @Input() switchingValue2: string;
  public showContentWidth = false;
  private curWwwPath: string;
  private pathName: string;
  private pos: number;

  constructor() {
  }

  ngOnInit() {
    this.curWwwPath = window.location.href;
    this.pathName = window.location.pathname;
    this.pos = this.curWwwPath.indexOf(this.pathName);
  }

  ngOnChanges(changes: SimpleChanges) {
    if (changes['data'] && changes['data'].currentValue) {
      if (this.data && this.data.length > 10) {
        this.showContentWidth = true;
      } else {
        this.showContentWidth = false;
      }
    }
  }
}

interface Images {
  icon?: string;
  iconHover?: string;
  titleImage?: string;
  bgImage?: string;
}
